﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace map.taobao
{
    public partial class mtaobao : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(AjaxFunction  ));

            if (!IsPostBack)
            {
                addheadinfo();
                if (this.Request.Url.AbsolutePath != ResolveUrl("~/member/login.aspx")
                    && this.Request.Url.AbsolutePath != ResolveUrl("~/member/regist1.aspx"))
                {
                    if (AliApi.appUserId == "")
                    {
                        HyperLink_login.Text = "登录";
                        HyperLink_login.NavigateUrl = ResolveUrl("~/member/login.aspx") + "?redirecturl=" + this.Request.Url;

                        HyperLink_logout.NavigateUrl = ResolveUrl("~/member/regist1.aspx") + "?redirecturl=" + this.Request.Url;
                        HyperLink_logout.Text = "注册";
                    }
                    else
                    {
                        HyperLink_login.Text = AliApi.appNickName;
                        HyperLink_login.NavigateUrl = "#";
                        HyperLink_logout.NavigateUrl = ResolveUrl("~/member/loginout.aspx") + "?redirecturl=" + this.Request.Url;
                        HyperLink_logout.Text = "注销";
                    }
                }
                else
                {
                    HyperLink_login.Text = "登录";
                    HyperLink_login.NavigateUrl = ResolveUrl("~/member/login.aspx")  ;

                    HyperLink_logout.NavigateUrl = ResolveUrl("~/member/regist1.aspx")  ;
                    HyperLink_logout.Text = "注册";
                }
            }
        }
        private void addheadinfo()
        {
            HtmlLink icoLink = new HtmlLink();
            icoLink.Href = ResolveUrl("~/img/favicon.ico");
            icoLink.Attributes.Add("rel", "shortcut icon");
            Page.Header.Controls.Add(icoLink);
        }
    }
}
